﻿using Autofac;
using Autofac.Extensions.DependencyInjection;
using Micro.Core.Packages;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Hosting;

namespace Microsoft.Extensions.DependencyInjection
{
    /// <summary>
    /// 全链路追踪
    /// </summary>
    public class APMPack : BasePackage
    {

        public override PackLevel Level => PackLevel.Framework;

        public override IServiceCollection AddServices(IServiceCollection services)
        {
            Environment.SetEnvironmentVariable("ASPNETCORE_HOSTINGSTARTUPASSEMBLIES", "SkyAPM.Agent.AspNetCore");
            services.AddSkyAPM();
            return services;
        }

        public override void UseHostBuilder(IHostBuilder hostBuilder, IServiceProvider services)
        {
            
        }

        public override void UsePack(WebApplication app)
        {
            //app.
            base.UsePack(app);
        }

    }
}